package de.dhbw.ka.tit09.picsim.ui;

import org.eclipse.core.databinding.observable.map.IObservableMap;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;

import de.dhbw.ka.tit09.picsim.ui.model.SourceTextTableElement;

/**
 * Label provider for the source text column.
 * 
 * @author Andreas Bender
 * 
 */
public class SourceTextColumnLabelProvider extends
		ObservableColumnLabelProvider {

	/**
	 * Constructor.
	 * 
	 * @param attributeMap the observable attributes
	 */
	public SourceTextColumnLabelProvider(IObservableMap attributeMap) {
		super(attributeMap);
	}

	/**
	 * Constructor.
	 * 
	 * @param attributeMaps the observable attributes
	 */
	public SourceTextColumnLabelProvider(IObservableMap[] attributeMaps) {
		super(attributeMaps);
	}

	public String getText(Object element) {
		if (element instanceof SourceTextTableElement) {
			return ((SourceTextTableElement) element).getText();
		}
		return null;
	}

	public Image getImage(Object element) {
		return null;
	}

	public Color getBackground(Object element) {
		if (element instanceof SourceTextTableElement
				&& ((SourceTextTableElement) element).isHighlighted()) {
			return Display.getDefault().getSystemColor(SWT.COLOR_YELLOW);
		}
		return null;

	}

}
